home *** CD-ROM | disk | FTP | other *** search
/ Chip 1998 February / CHIP Şubat 1998.iso / drivers / YAZICI / HP / LASERJET / MOPIER / WIN95 / LJ146GE.EXE / DISK1 / SETUP.MS_ / SETUP.MS
Encoding:
Text File  |  1996-10-01  |  46.6 KB  |  1,221 lines

  1. '**************************************************************************
  2. '*                       MSSetup Toolkit Sample 1
  3. '**************************************************************************
  4.  
  5. '''$DEFINE   ''Define for script development/debugging
  6.  
  7. '$INCLUDE 'setupapi.inc'
  8. '$INCLUDE 'msdetect.inc'
  9.  
  10.  
  11. ''Dialog ID's (mine)
  12. '$INCLUDE 'dialogid.inc'
  13. '$INCLUDE 'symbols.inc'
  14.  
  15. ''Const integers
  16. CONST c_iMINIMUM=     1499
  17. CONST c_iDISKIMAGE=     1500
  18. CONST c_iCOMPLETE =     1501
  19. CONST c_iCUSTOM =       1502
  20. CONST c_iNETADMIN =     1503
  21. CONST c_iRETRY =        1504
  22. CONST c_iPORT =         1505
  23. CONST c_iSKIP =         1506
  24. CONST c_iSELECT_COMPONENTS =    1509
  25. CONST c_iSELECT_PORT =      1510
  26. CONST c_iSELECT_PRINTER =   1511
  27. CONST c_iREBOOT =       1515
  28. CONST c_iRESUME =       1516
  29. CONST c_iBACK =         1517
  30. CONST c_iCONTINUE =     1518
  31. CONST c_iEXIT =         1519
  32. CONST c_iOK =         1520
  33. CONST c_iCANCEL =         1521
  34. CONST c_iYES =         1522
  35. CONST c_iNO =         1523
  36. CONST c_iINVALID =      -999
  37. CONST c_iGO_BACK =    3001
  38.  
  39. CONST EW_REBOOTSYSTEM = 67
  40. CONST EW_RESTARTWINDOWS = 66
  41.  
  42. '' These need to be the same number as in resource.h
  43. const  IDS_STATWIN_TITLE% = 200
  44. const IDS_INFO_FILE_NAME% = 1
  45. const IDS_CORRUPT_SETUP_FILE% = 2
  46. const IDS_ABORT_INSTALL% =  3
  47. const IDS_NO_SELECTIONS% =  4
  48. const IDS_UNABLE_ALADDIN_1% =   5
  49. const IDS_UNABLE_ALADDIN_2% =   6
  50. const IDS_UNABLE_ALADDIN_3% =   7
  51. const IDS_UNABLE_ALADDIN_CAP% = 8
  52. const IDS_NETADMIN_1% = 9
  53. const IDS_NETADMIN_2% = 10
  54. const IDS_SYSTEM_TITLE% = 100
  55.  
  56. CONST c_iPROGRESS_WIDTH = 220           '' Width of the progress indicator
  57. CONST c_iPROGRESS_HEIGHT = 100          '' Height of the progress indicator
  58.  
  59. CONST c_iPT_LOCAL   = 1     '' Used for Port connections, could be network mapping or local connect.
  60. CONST c_iPT_NETWORK = 2
  61.  
  62. ''Const DLL dialog functions
  63. CONST c_szWELCOME_DLG_PROC$ = "WelcomeDlgProc"
  64. CONST c_szMETHOD_DLG_PROC$ = "MethodDlgProc"
  65. CONST c_szNETADMIN_DLG_PROC$ = "NetAdminInfoDlgProc"
  66. CONST c_szPORT_DLG_PROC$ = "PortDlgProc"
  67. CONST c_szBIDI_PROBLEM_DLG_PROC$ = "BidiProbDlgProc"
  68. CONST c_szUNSUPPORTED_DLG_PROC$ = "UnsupportedDlgProc"
  69. CONST c_szPRINTER_DLG_PROC$ = "PrinterDlgProc"
  70. CONST c_szCOMPONENT_DLG_PROC$ = "ComponentDlgProc"
  71. CONST c_szNOSPACE_DLG_PROC$ = "NoSpaceDlgProc"
  72. CONST c_szVERIFY_DLG_PROC$ = "VerifyDlgProc"
  73. CONST c_szVERIFY_FAIL_DLG_PROC$ = "VerifyFailDlgProc"
  74. CONST c_szFINAL_DLG_PROC$ = "FinalDlgProc"
  75. CONST c_szFINAL_ADMIN_DLG_PROC$ = "FinalDlgProc"
  76. CONST c_szREBOOT_DLG_PROC$ = "RebootDlgProc"
  77. CONST c_szEXIT_DLG_PROC$ =  "ExitDlgProc"
  78. CONST c_szBILLBOARD_DLG_PROC$ = "BillboardDlgProc"
  79. CONST c_szINVISIBLE_DLG_PROC$ = "InvisibleDlgProc"
  80. CONST c_szHPLOGO_DLG_PROC$ = "HPLogoDlgProc"
  81. CONST c_szEXECUTE_DLG_PROC$ = "ExecuteDlgProc"
  82. CONST c_szALADDIN_DLG_PROC$ = "AladdinDlgProc"
  83. CONST c_szCOPYRIGHT_DLG_PROC$ = "CopyRightDlgProc"
  84. CONST c_szDISK_IMAGE_DLG_PROC$ = "DiskImageDlgProc"
  85. CONST c_szUPDATE32_TEMPFILE$ = "UPDATE32.TMP"
  86.  
  87. ''Const strings
  88. CONST c_szEMPTY$ = ""
  89. CONST c_szLOG_FILE$ = "HPLJ5SIM.LOG"
  90. CONST c_szINFO_FILE$ = "SETUP.INF"
  91. CONST c_szLOG_FILE_LIST$ = "logfile"
  92. CONST c_szFAILURE$ = "fail"
  93. CONST c_szSUCCESS$ = "success"
  94. CONST c_szALADDIN$ = "fontsmart.comp"
  95. CONST c_szALADDIN_CUSTOM$ = "fontsmart.custom.fonts"
  96. const c_szALL_FONTS$ = "fontsmart.all.fonts"
  97. CONST c_szALADDIN_CMD_LINE$ = "fontsmrt /b "
  98. const c_szFONTLIST_PCL$ = "fontlist.pcl"
  99. const c_szFONTLIST_PS$ = "fontlist.ps"
  100. const c_szALLFONTS_FILE$ = "allfonts.txt"
  101. const c_szALADDIN_EXIT_MSG$ = "FontSmartExiting"
  102.  
  103. CONST c_lpszSECTION_LIST$ = "ComponentSectionList"
  104. CONST c_lpszCOMPONENT_LIST$ = "ComponentList"
  105. CONST c_lpszINSTALL_STRING_LIST$ = "InstallStringList"
  106. CONST c_szMSCUISTF = "MSCUISTF.DLL"
  107. CONST c_sz95HELPFILE$ = "hpinstal.gid"
  108.  
  109. ''Support DLL
  110. '$INCLUDE 'support.inc'
  111.  
  112. ''Bitmap ID
  113. CONST LOGO = IDB_HP_LOGO
  114.  
  115. ''Message IDs
  116. CONST WM_USER = 1024        '' 0x0400
  117. CONST WM_CLEANUP = WM_USER + 200
  118.  
  119.  
  120. GLOBAL g_iReturn as integer
  121. GLOBAL g_dwBidiReady as long
  122. GLOBAL g_hWndFrame as integer
  123. GLOBAL g_iMethod as integer
  124. GLOBAL g_iInstallOk as integer
  125. GLOBAL g_szClose as string
  126. GLOBAL g_pEnvironment as pointer to ENVIRONMENT
  127. GLOBAL g_szDest as string
  128. GLOBAL g_iIsChicago as integer
  129.  
  130. DECLARE FUNCTION Install() as INTEGER
  131. DECLARE FUNCTION MakePath( szDir$, szFile$ ) AS STRING
  132.  
  133. DECLARE FUNCTION DoMyMsgBox(iCap%, iMsg%, wType%) as integer
  134. DECLARE FUNCTION LogUserOptions() as integer
  135. DECLARE FUNCTION LogEnvironment() as integer
  136. DECLARE FUNCTION LogInstallation(szSection$) as integer
  137. DECLARE FUNCTION CopyFiles() as integer
  138. DECLARE FUNCTION SetupUIDlg(szDll$, idDlg%, szDlgProc$,idHelpDlg%, szHelpProc$) as integer
  139. DECLARE FUNCTION GetButtonId(szString$) as integer
  140. DECLARE function MergeStrings(szStr1$, szStr2$) as string
  141. declare sub Clean()
  142. declare function DoAladdin() as integer
  143. declare function GetInstString(iStringId%) as string
  144.  
  145. declare function GetGaugeDlgUnitsX  lib "mscuistf.dll" () as integer
  146. declare function GetGaugeDlgUnitsY  lib "mscuistf.dll" () as integer
  147. declare function EnoughSpace  lib "mscuistf.dll" () as integer
  148. declare function SetExecBlock  lib "mscuistf.dll" (lpszCmdLine$, lpszExitMsg$) as integer
  149. declare function GetExecBlockReturn  lib "mscuistf.dll" () as integer
  150.  
  151. '' Windows API functions
  152. declare function GetNumTasks   lib "Kernel" () as integer
  153. declare function GetModuleHandle   lib "Kernel" (lpstr$) as integer
  154. declare function WinExec lib "Kernel" (szCommand$, uiShow%) as integer
  155. declare function lstrcat lib "Kernel" (g_szDest$, szSource$) as long
  156. declare function lstrlen lib "Kernel" (szSource$) as integer
  157. declare function GetFreeSpace lib "Kernel" (iFlags%) as long
  158.  
  159.  
  160.  
  161. '$IFNDEF MSTEST_20
  162. declare function ExitWindows lib "user" (dwRestart&, iReserved%) as integer
  163. '$ENDIF
  164.  
  165. '$IFDEF DEBUG
  166. declare sub OutputDebugString lib "Kernel" ( szStr$)
  167. '$ENDIF
  168.  
  169. INIT:
  170.     dim iReturn as integer
  171.     dim szDialogProc as string
  172.     dim iIdDialog as integer
  173.     dim iSuccess as integer
  174.     dim ipSuccess as pointer to integer
  175.     dim iProcessor as integer
  176.     dim iPortType as integer
  177.  
  178.     ipSuccess = VARPTR( iSuccess )
  179.  
  180.     g_hWndFrame = HwndFrame()
  181.    ''
  182.    '' Moved this call to FixMainWindow To support getting verion info for NT
  183.    ''
  184.    iReturn = FixMainWindow( g_hWndFrame )
  185.  
  186.     g_iReturn = Initialize()
  187.     SetTitle GetInstString(IDS_SYSTEM_TITLE)
  188.  
  189.     if InstallOnThisOS() = 0 then
  190.         goto QUIT
  191.     endif
  192.     '' Initialize empty lists
  193.     SetSymbolValue c_szLOG_FILE_LIST ,  c_szEMPTY
  194.     SetSymbolValue c_szFAILURE , c_szEMPTY
  195.     SetSymbolValue c_szSUCCESS , c_szEMPTY
  196.  
  197.  
  198.     szInf$ = GetSymbolValue("STF_SRCINFPATH")
  199.     IF szInf$ = c_szEMPTY THEN
  200.         szInf$ = GetSymbolValue("STF_CWDDIR") + "SETUP.INF"
  201.     END IF
  202.     ReadInfFile szInf$
  203.  
  204.  
  205.     g_pEnvironment = GetInstallEnvironment()
  206.     ''g_pEnvironment[0].iOSIsNT = 0
  207.     ''g_pEnvironment[0].iOSMajor = 3
  208.     ''g_pEnvironment[0].iOSMinor = 10
  209.  
  210.     ''
  211.     '' Check for Win95. OS major is >= 4 or OS major is 3 and OS minor > 11
  212.     ''
  213.     g_iIsChicago = 0
  214.     if g_pEnvironment[0].iOSMajor >= 4 then
  215.          g_iIsChicago = 1
  216.     endif
  217.     if g_pEnvironment[0].iOSMajor = 3 AND g_pEnvironment[0].iOSMinor > 11 then
  218.          g_iIsChicago = 1
  219.     endif
  220.  
  221.     g_szDest = UIStartDlg(c_szMSCUISTF$, IDD_HPLOGO, c_szHPLOGO_DLG_PROC,0,c_szEMPTY)
  222.  
  223.     g_szDest = UIStartDlg(c_szMSCUISTF$, IDD_COPYRIGHT, c_szCOPYRIGHT_DLG_PROC,0,c_szEMPTY)
  224.     '' Have the script send a beep when requesting new diskettes.
  225.     iReturn = SetBeepingMode(1)
  226.  
  227.     iReturn = LogEnvironment()
  228.     iProcessor = GetProcessorType()
  229.     szDialogProc =  c_szWELCOME_DLG_PROC
  230.     iIdDialog = IDD_WELCOME
  231.     g_pEnvironment = GetInstallEnvironment
  232.  
  233. GOBACK:
  234.     iPortType = c_iPT_LOCAL
  235.  
  236.     WHILE szDialogProc <> c_szEMPTY
  237.         iReturn = SetupUIDlg(c_szMSCUISTF$, iIdDialog, szDialogProc, 0, c_szEMPTY)
  238.  
  239.         if (iReturn = c_iEXIT) then
  240.             GOSUB ASKQUIT
  241.         else
  242.             '' This is need to prevent having a duplicate case, since this *@($(!* (stupid)
  243.             '' scripting language wont let your cases fall through to the next case.
  244.             if (iIdDialog = IDD_METHOD_SHARED) then
  245.                 iIdDialog = IDD_METHOD_NONET
  246.             endif
  247.  
  248.  
  249.             UIPop 1
  250.             SELECT CASE iIdDialog
  251.                 CASE IDD_WELCOME
  252.                     ''
  253.                     '' If other tasks are running and we are not in the ultimate
  254.                     '' in multasking os, NT! then put up a warning dialog message
  255.                     ''
  256.                     if ( ( GetTaskCount() > 0) AND ( g_pEnvironment[0].iOSIsNT = 0) ) then
  257.                         iIdDialog = IDD_TASK_PROMPT
  258.                         szDialogProc = c_szWELCOME_DLG_PROC
  259.                     else
  260.                         g_szDest = g_pEnvironment[0].szSystemDir[0]
  261.                         if (0 = IsDirWritable(g_szDest) ) then
  262.                             iIdDialog = IDD_METHOD_SHARED
  263.                             szDialogProc = c_szMETHOD_DLG_PROC
  264.                         elseif (g_pEnvironment[0].iInstallType = IT_STANDALONE) then
  265.                             iIdDialog = IDD_METHOD_NONET
  266.                             szDialogProc = c_szMETHOD_DLG_PROC
  267.                         else
  268.                             iIdDialog = IDD_METHOD
  269.                             szDialogProc = c_szMETHOD_DLG_PROC
  270.                         endif
  271.                     endif
  272.                     iReturn  = LogInstallation("[TaskList]")
  273.  
  274.                 CASE IDD_TASK_PROMPT
  275.                     g_szDest = g_pEnvironment[0].szSystemDir[0]
  276.                     if (0 = IsDirWritable(g_szDest) ) then
  277.                         iIdDialog = IDD_METHOD_SHARED
  278.                         szDialogProc = c_szMETHOD_DLG_PROC
  279.                     elseif (g_pEnvironment[0].iInstallType = IT_STANDALONE) then
  280.                         iIdDialog = IDD_METHOD_NONET
  281.                         szDialogProc = c_szMETHOD_DLG_PROC
  282.                     else
  283.                         iIdDialog = IDD_METHOD
  284.                         szDialogProc = c_szMETHOD_DLG_PROC
  285.                     endif
  286.  
  287.                 CASE IDD_METHOD
  288.                     g_iMethod =  iReturn
  289.  
  290.                     if iReturn = c_iNETADMIN then
  291.                         iIdDialog = IDD_ADMIN_INFO
  292.                         szDialogProc = c_szNETADMIN_DLG_PROC
  293.                     else
  294.                         iIdDialog = IDD_SELECT_PORT
  295.                         szDialogProc = c_szPORT_DLG_PROC
  296.                     endif
  297.                     iReturn = ReadInfoFile(iProcessor)
  298.                     if iReturn <> 0 then
  299.                         if iReturn <> c_iDO_NET_ADMIN then
  300.                            iReturn = DoMyMsgBox( IDS_CORRUPT_SETUP_FILE, IDS_ABORT_INSTALL, MB_OK or MB_APPLMODAL or MB_ICONSTOP )
  301.                         else
  302.                             g_szDest =   GetInstString(IDS_NETADMIN_1) + GetInstString(IDS_NETADMIN_2)
  303.                             iReturn = DoMsgBox( g_szDest, GetInstString(IDS_ABORT_INSTALL), MB_OK or MB_APPLMODAL or MB_ICONSTOP )
  304.                         endif
  305.                         goto QUIT
  306.                     elseif g_iMethod = c_iDISKIMAGE then
  307.                         if 0 = ReadAllFileGroups() then
  308.                             iIdDialog = IDD_DISKIMAGE
  309.                             szDialogProc = c_szDISK_IMAGE_DLG_PROC
  310.                         else
  311.                             iReturn = DoMyMsgBox( IDS_CORRUPT_SETUP_FILE, IDS_ABORT_INSTALL, MB_OK or MB_APPLMODAL or MB_ICONSTOP )
  312.                             goto QUIT
  313.                         endif
  314.                     elseif iIdDialog <> IDD_ADMIN_INFO AND CheckBidi() = 1 then
  315.                         iReturn = IsSupportedPrinterAttached( ipSuccess )
  316.                         if iReturn AND iSuccess = 1 then
  317.                             if 0 <> SetSelectionsForPrinter() then
  318.                                 iReturn = DoMyMsgBox( IDS_CORRUPT_SETUP_FILE, IDS_ABORT_INSTALL, MB_OK or MB_APPLMODAL or MB_ICONSTOP )
  319.                                 goto QUIT
  320.                             elseif 0 = ReadAllFileGroups() then
  321.                                 if g_iMethod  <> c_iCOMPLETE AND g_iMethod  <> c_iMINIMUM then
  322.                                     iIdDialog = IDD_SELECT_COMPONENTS
  323.                                     szDialogProc =c_szCOMPONENT_DLG_PROC
  324.                                 else
  325.                                     szDialogProc = c_szEMPTY
  326.                                 endif
  327.                             else
  328.                                 iReturn = DoMyMsgBox( IDS_CORRUPT_SETUP_FILE, IDS_ABORT_INSTALL, MB_OK or MB_APPLMODAL or MB_ICONSTOP )
  329.                                 goto QUIT
  330.                             endif
  331.                         elseif IsNetworked() = 0 then
  332.                             iIdDialog = IDD_SELECT_PORT
  333.                             szDialogProc = c_szPORT_DLG_PROC
  334.                         else
  335.                             iIdDialog = IDD_SELECT_NET_PORT
  336.                             szDialogProc = c_szPORT_DLG_PROC
  337.                             iPortType = c_iPT_NETWORK
  338.                         endif
  339.                     endif
  340.  
  341.                  CASE IDD_METHOD_NONET
  342.                     g_iMethod =  iReturn
  343.                     iReturn = ReadInfoFile(iProcessor)
  344.                     if iReturn <> 0 then
  345.                         if iReturn <> c_iDO_NET_ADMIN then
  346.                            iReturn = DoMyMsgBox( IDS_CORRUPT_SETUP_FILE, IDS_ABORT_INSTALL, MB_OK or MB_APPLMODAL or MB_ICONSTOP )
  347.                         else
  348.                             g_szDest =   GetInstString(IDS_NETADMIN_1) + GetInstString(IDS_NETADMIN_2)
  349.                             iReturn = DoMsgBox( g_szDest, GetInstString(IDS_ABORT_INSTALL), MB_OK or MB_APPLMODAL or MB_ICONSTOP )
  350.                         endif
  351.                         goto QUIT
  352.                     elseif g_iMethod = c_iDISKIMAGE then
  353.                         if 0 = ReadAllFileGroups() then
  354.                             iIdDialog = IDD_DISKIMAGE
  355.                             szDialogProc = c_szDISK_IMAGE_DLG_PROC
  356.                         else
  357.                             iReturn = DoMyMsgBox( IDS_CORRUPT_SETUP_FILE, IDS_ABORT_INSTALL, MB_OK or MB_APPLMODAL or MB_ICONSTOP )
  358.                             goto QUIT
  359.                         endif
  360.                     else
  361.  
  362.                         if CheckBidi() = 1 then
  363.                             iReturn = IsSupportedPrinterAttached( ipSuccess )
  364.                             if iReturn AND iSuccess = 1 then
  365.                                 if 0 <> SetSelectionsForPrinter() then
  366.                                     iReturn = DoMyMsgBox( IDS_CORRUPT_SETUP_FILE, IDS_ABORT_INSTALL, MB_OK or MB_APPLMODAL or MB_ICONSTOP )
  367.                                     goto QUIT
  368.                                 elseif 0 = ReadAllFileGroups() then
  369.                                     if g_iMethod  <> c_iCOMPLETE  AND g_iMethod  <> c_iMINIMUM then
  370.                                         iIdDialog = IDD_SELECT_COMPONENTS
  371.                                         szDialogProc =c_szCOMPONENT_DLG_PROC
  372.                                     else
  373.                                         szDialogProc = c_szEMPTY
  374.                                     endif
  375.                                 else
  376.                                     iReturn = DoMyMsgBox( IDS_CORRUPT_SETUP_FILE, IDS_ABORT_INSTALL, MB_OK or MB_APPLMODAL or MB_ICONSTOP )
  377.                                     goto QUIT
  378.                                 endif
  379.                             elseif IsNetworked() = 1 then
  380.                                 iIdDialog = IDD_SELECT_NET_PORT
  381.                                 szDialogProc = c_szPORT_DLG_PROC
  382.                                 iPortType = c_iPT_NETWORK
  383.                             else
  384.                                 iIdDialog = IDD_SELECT_PORT
  385.                                 szDialogProc = c_szPORT_DLG_PROC
  386.                             endif
  387.                         else
  388.                             if IsNetworked() = 1 then
  389.                                 iIdDialog = IDD_SELECT_NET_PORT
  390.                                 szDialogProc = c_szPORT_DLG_PROC
  391.                                 iPortType = c_iPT_NETWORK
  392.                             else
  393.                                 iIdDialog = IDD_SELECT_PORT
  394.                                 szDialogProc = c_szPORT_DLG_PROC
  395.                             endif
  396.                         endif
  397.                     endif
  398.  
  399.                 CASE IDD_DISKIMAGE
  400.                     if iReturn = c_iBACK then
  401.                         g_szDest = g_pEnvironment[0].szSystemDir[0]
  402.                         if (0 = IsDirWritable(g_szDest) ) then
  403.                             iIdDialog = IDD_METHOD_SHARED
  404.                             szDialogProc = c_szMETHOD_DLG_PROC
  405.                         elseif (g_pEnvironment[0].iInstallType = IT_STANDALONE) then
  406.                             iIdDialog = IDD_METHOD_NONET
  407.                             szDialogProc = c_szMETHOD_DLG_PROC
  408.                         else
  409.                             iIdDialog = IDD_METHOD
  410.                             szDialogProc = c_szMETHOD_DLG_PROC
  411.                         endif
  412.                     else
  413.                             szDialogProc = c_szEMPTY
  414.                     endif
  415.  
  416.                 CASE IDD_ADMIN_INFO
  417.  
  418.                     if iReturn = c_iBACK then
  419.                         iIdDialog = IDD_METHOD
  420.                         szDialogProc = c_szMETHOD_DLG_PROC
  421.                     else
  422.                         if CheckBidi() = 1 then
  423.                             iReturn = IsSupportedPrinterAttached( ipSuccess )
  424.                             if iReturn AND iSuccess = 1 then
  425.                                 if 0 <> SetSelectionsForPrinter() then
  426.                                     iReturn = DoMyMsgBox( IDS_CORRUPT_SETUP_FILE, IDS_ABORT_INSTALL, MB_OK or MB_APPLMODAL or MB_ICONSTOP )
  427.                                     goto QUIT
  428.                                 elseif 0 = ReadAllFileGroups() then
  429.                                     iIdDialog = IDD_SELECT_COMPONENTS
  430.                                     szDialogProc =c_szCOMPONENT_DLG_PROC
  431.                                 else
  432.                                     iReturn = DoMyMsgBox( IDS_CORRUPT_SETUP_FILE, IDS_ABORT_INSTALL, MB_OK or MB_APPLMODAL or MB_ICONSTOP )
  433.                                     goto QUIT
  434.                                 endif
  435.                             else
  436.                                 iIdDialog = IDD_SELECT_PRINTER
  437.                                 szDialogProc =c_szPRINTER_DLG_PROC
  438.                             endif
  439.                         else
  440.                             iIdDialog = IDD_SELECT_PRINTER
  441.                             szDialogProc =c_szPRINTER_DLG_PROC
  442.                         endif
  443.  
  444.                     endif
  445.  
  446.                 CASE IDD_SELECT_NET_PORT
  447.  
  448.                     if iReturn = c_iBACK then
  449.                         g_szDest = g_pEnvironment[0].szSystemDir[0]
  450.                         if (0 = IsDirWritable(g_szDest) ) then
  451.                             iIdDialog = IDD_METHOD_SHARED
  452.                             szDialogProc = c_szMETHOD_DLG_PROC
  453.                         elseif (g_pEnvironment[0].iInstallType = IT_STANDALONE) then
  454.                             iIdDialog = IDD_METHOD_NONET
  455.                             szDialogProc = c_szMETHOD_DLG_PROC
  456.                         else
  457.                             iIdDialog = IDD_METHOD
  458.                             szDialogProc = c_szMETHOD_DLG_PROC
  459.                         endif
  460.  
  461.                     else
  462.                         iIdDialog = IDD_SELECT_PRINTER
  463.                         szDialogProc =c_szPRINTER_DLG_PROC
  464.                     endif
  465.  
  466.  
  467.                 CASE IDD_SELECT_PORT
  468.  
  469.                     if iReturn = c_iBACK then
  470.                         g_szDest = g_pEnvironment[0].szSystemDir[0]
  471.                         if (0 = IsDirWritable(g_szDest) ) then
  472.                             iIdDialog = IDD_METHOD_SHARED
  473.                             szDialogProc = c_szMETHOD_DLG_PROC
  474.                         elseif (g_pEnvironment[0].iInstallType = IT_STANDALONE) then
  475.                             iIdDialog = IDD_METHOD_NONET
  476.                             szDialogProc = c_szMETHOD_DLG_PROC
  477.                         else
  478.                             iIdDialog = IDD_METHOD
  479.                             szDialogProc = c_szMETHOD_DLG_PROC
  480.                         endif
  481.                     else
  482.                         if CheckBidi() = 1 then
  483.                             iReturn = TestBidi(g_pEnvironment[0].runTime.lpszPort[0])
  484.                             '' The return value could be true and have no bidi
  485.                             if iReturn <> 0 AND g_pEnvironment[0].runTime.bHasBidi = 0 then
  486.                                 '' If we get here bidi could not be established, so the port type
  487.                                 '' is something other than LPT
  488.                                 iIdDialog = IDD_SELECT_PRINTER
  489.                                 szDialogProc =c_szPRINTER_DLG_PROC
  490.                             elseif g_pEnvironment[0].runTime.bHasBidi = 0 then
  491.                                 iIdDialog = IDD_BIDI_PROBLEM
  492.                                 szDialogProc =c_szBIDI_PROBLEM_DLG_PROC
  493.                             elseif 0 < lstrlen(g_pEnvironment[0].runTime.lpszDeviceID[0]) then
  494.  
  495.                                 iReturn = IsPrinterSupported( g_pEnvironment[0].runTime.lpszDeviceID[0])
  496.                                 if iReturn = 0 then
  497.                                     iIdDialog = IDD_UNSUPPORTED_PRINTER
  498.                                     szDialogProc =c_szUNSUPPORTED_DLG_PROC
  499.                                 else
  500.                                     iIdDialog = IDD_SELECT_PRINTER
  501.                                     szDialogProc =c_szPRINTER_DLG_PROC
  502.                                 endif
  503.                             else
  504.                                 iIdDialog = IDD_SELECT_PRINTER
  505.                                 szDialogProc =c_szPRINTER_DLG_PROC
  506.                             endif
  507.  
  508.                         else
  509.                             iIdDialog = IDD_SELECT_PRINTER
  510.                             szDialogProc =c_szPRINTER_DLG_PROC
  511.                         endif
  512.  
  513.                     endif
  514.                 CASE IDD_BIDI_PROBLEM
  515.  
  516.                     if iReturn = c_iSKIP then
  517.                             iIdDialog = IDD_SELECT_PRINTER
  518.                             szDialogProc =c_szPRINTER_DLG_PROC
  519.                     elseif iReturn = c_iRETRY then
  520.                         iReturn = TestBidi(g_pEnvironment[0].runTime.lpszPort[0])
  521.  
  522.                         if iReturn <> 0 AND g_pEnvironment[0].runTime.bHasBidi = 0 then
  523.                             '' If we get here bidi could not be established, so the port type
  524.                             '' is something other than LPT
  525.                             iIdDialog = IDD_SELECT_PRINTER
  526.                             szDialogProc =c_szPRINTER_DLG_PROC
  527.                         elseif g_pEnvironment[0].runTime.bHasBidi <> 0 then
  528.                             if 0 < lstrlen(g_pEnvironment[0].runTime.lpszDeviceID[0]) then
  529.  
  530.                                 iReturn = IsPrinterSupported( g_pEnvironment[0].runTime.lpszDeviceID[0])
  531.                                 if iReturn = 0 then
  532.                                     iIdDialog = IDD_UNSUPPORTED_PRINTER
  533.                                     szDialogProc =c_szUNSUPPORTED_DLG_PROC
  534.                                 else
  535.                                     iIdDialog = IDD_SELECT_PRINTER
  536.                                     szDialogProc =c_szPRINTER_DLG_PROC
  537.                                 endif
  538.                             else
  539.                                 iIdDialog = IDD_SELECT_PRINTER
  540.                                 szDialogProc =c_szPRINTER_DLG_PROC
  541.                             endif
  542.                         endif
  543.                     elseif iReturn = c_iPORT then
  544.                         iIdDialog = IDD_SELECT_PORT
  545.                         szDialogProc = c_szPORT_DLG_PROC
  546.                     endif
  547.  
  548.                 CASE IDD_SELECT_PRINTER
  549.                     if iReturn = c_iBACK then
  550.                         g_szDest = g_pEnvironment[0].szSystemDir[0]
  551.                         if (g_pEnvironment[0].iInstallType = IT_STANDALONE) or (0 = IsDirWritable(g_szDest) ) then
  552.                             if iPortType = c_iPT_NETWORK then
  553.                                 iIdDialog = IDD_SELECT_NET_PORT
  554.                                 szDialogProc = c_szPORT_DLG_PROC
  555.                             else
  556.                                 iIdDialog = IDD_SELECT_PORT
  557.                                 szDialogProc = c_szPORT_DLG_PROC
  558.                             endif
  559.                         else
  560.                             iIdDialog = IDD_METHOD
  561.                             szDialogProc = c_szMETHOD_DLG_PROC
  562.                         endif
  563.  
  564.                     else
  565.                         if 0 <> SetSelectionsForPrinter() then
  566.                             iReturn = DoMyMsgBox( IDS_CORRUPT_SETUP_FILE, IDS_ABORT_INSTALL, MB_OK or MB_APPLMODAL or MB_ICONSTOP )
  567.                             goto QUIT
  568.                         elseif 0 = ReadAllFileGroups() then
  569.                             if g_iMethod  <> c_iCOMPLETE AND g_iMethod  <> c_iMINIMUM then
  570.                                 iIdDialog = IDD_SELECT_COMPONENTS
  571.                                 szDialogProc =c_szCOMPONENT_DLG_PROC
  572.                             else
  573.                                 szDialogProc = c_szEMPTY
  574.                             endif
  575.                         else
  576.                             iReturn = DoMyMsgBox( IDS_CORRUPT_SETUP_FILE, IDS_ABORT_INSTALL, MB_OK or MB_APPLMODAL or MB_ICONSTOP )
  577.                             goto QUIT
  578.                         endif
  579.                     endif
  580.  
  581.                 CASE IDD_UNSUPPORTED_PRINTER
  582.                     if iReturn = c_iSELECT_PORT then
  583.                         if iPortType = c_iPT_NETWORK then
  584.                             iIdDialog = IDD_SELECT_NET_PORT
  585.                             szDialogProc = c_szPORT_DLG_PROC
  586.                         else
  587.                             iIdDialog = IDD_SELECT_PORT
  588.                             szDialogProc = c_szPORT_DLG_PROC
  589.                         endif
  590.                     else
  591.                         iIdDialog = IDD_SELECT_PRINTER
  592.                         szDialogProc =c_szPRINTER_DLG_PROC
  593.                     endif
  594.  
  595.                 CASE IDD_SELECT_COMPONENTS
  596.                     if iReturn = c_iBACK then
  597.                         if g_iMethod = c_iNETADMIN then
  598.                             iIdDialog = IDD_ADMIN_INFO
  599.                             szDialogProc = c_szNETADMIN_DLG_PROC
  600.                         elseif iReturn = c_iPORT then
  601.                             iIdDialog = IDD_SELECT_PRINTER
  602.                             szDialogProc =c_szPRINTER_DLG_PROC
  603.                         elseif iPortType = c_iPT_NETWORK then
  604.                             iIdDialog = IDD_SELECT_NET_PORT
  605.                             szDialogProc = c_szPORT_DLG_PROC
  606.                         else
  607.                             iIdDialog = IDD_SELECT_PORT
  608.                             szDialogProc = c_szPORT_DLG_PROC
  609.                         endif
  610.                     else
  611.                         szDialogProc = c_szEMPTY
  612.                     endif
  613.  
  614.  
  615.                 CASE IDD_NO_SPACE
  616.                     if iReturn = c_iSELECT_COMPONENTS then
  617.                         if g_iMethod = c_iDISKIMAGE then
  618.                             iIdDialog = IDD_DISKIMAGE
  619.                             szDialogProc = c_szDISK_IMAGE_DLG_PROC
  620.                         else
  621.                             iIdDialog = IDD_SELECT_COMPONENTS
  622.                             szDialogProc =c_szCOMPONENT_DLG_PROC
  623.                         endif
  624.                     else
  625.                         GOTO QUIT
  626.                     endif
  627.             END SELECT
  628.         endif
  629.  
  630.         if szDialogProc = c_szEMPTY then
  631.             if EnoughSpace() = 0 then
  632.                 iIdDialog = IDD_NO_SPACE
  633.                 szDialogProc = c_szNOSPACE_DLG_PROC
  634.             endif
  635.         endif
  636.     wend
  637.  
  638.     iReturn = AnyComponentsSelected()
  639.     if  iReturn = 0 then
  640.         iReturn = DoMyMsgBox( IDS_NO_SELECTIONS,IDS_ABORT_INSTALL, 36)
  641.         if iReturn = 6 then
  642.             iIdDialog = IDD_SELECT_COMPONENTS
  643.             szDialogProc =c_szCOMPONENT_DLG_PROC
  644.             goto GOBACK
  645.         endif
  646.         goto QUIT
  647.     elseif iReturn < 0 then
  648.         iReturn = DoMyMsgBox( IDS_CORRUPT_SETUP_FILE, IDS_ABORT_INSTALL, MB_OK or MB_APPLMODAL or MB_ICONSTOP )
  649.         goto QUIT
  650.     endif
  651.  
  652.     if  g_iMethod = c_iDISKIMAGE then
  653.         iReturn = SetDecompMode(0)
  654.     endif
  655.  
  656.     iReturn = FSetSymbolValue( c_lpszSECTION_LIST, c_szEMPTY)
  657.     iReturn =FSetSymbolValue( c_lpszCOMPONENT_LIST, c_szEMPTY)
  658.  
  659.     SetRestartDir g_pEnvironment[0].szTempDir[0]
  660.     '$IFDEF DEBUG
  661.     WriteToLogFile "Restart Directory: "+ g_szDest
  662.     OutputDebugString("Restarting at "+g_szDest+" ..." + chr$(10))
  663.     '$ENDIF
  664.  
  665.     g_szDest = UIStartDlg( c_szMSCUISTF$, IDD_INVISIBLE, c_szINVISIBLE_DLG_PROC, 0, c_szEMPTY)
  666.     if Install() = 0 then
  667.         iCursor% = ShowWaitCursor
  668.         '' Update .ini files
  669.         iReturn = IniActionUpdate()
  670.         iReturn  = LogInstallation("[InstallTimeModificationsAdditions]")
  671.  
  672.         RestoreCursor iCursor%
  673.    endif
  674.  
  675.     '' The next line make sure the setup window is the active window, it might not
  676.     '' be if the program manager was called.
  677.     UIPop 1
  678.  
  679.     iRestartWin32% = 0
  680.     if g_iIsChicago = 1 OR g_pEnvironment[0].iOSIsNT = 1 then
  681.  
  682.             g_szDest = UIStartDlg( c_szMSCUISTF$, IDD_BILLBOARD_1,c_szBILLBOARD_DLG_PROC,0, c_szEMPTY)
  683.             iCursor% = ShowWaitCursor
  684.             iRestartWin32 = Copy32BitFiles()
  685.             if 0 < iRestartWin32  then
  686.                 g_pEnvironment[0].runTime.bReboot = 1
  687.             endif
  688.  
  689.             iReturn = LogInstallation("[Win32BitFileInstall]")
  690.             RestoreCursor iCursor%
  691.             UIPop 1
  692.     ''
  693.     '' Run the 32 bit executable to update the registry, and call the 32driver install
  694.     ''
  695.         g_szDest = MakePath(g_pEnvironment[0].szTempDir[0], c_szUPDATE32_TEMPFILE)
  696.         '' Check to see if the file exists before we run the executable
  697.         if DoesFileExist(g_szDest,femExists) then
  698.             '' Make executable path
  699.             g_szDest = MakePath(g_pEnvironment[0].szTempDir[0], "update32.exe")
  700.             if SetExecBlock(g_szDest, "Update32Exiting") then
  701.                 g_szDest = UIStartDlg( c_szMSCUISTF, IDD_INVISIBLE, c_szEXECUTE_DLG_PROC, 0, c_szEMPTY)
  702.                 UIPop 1
  703.                 iReturn = GetExecBlockReturn()
  704.  
  705.                 if iReturn < 32 then
  706.                     WriteToLogFile "ERROR!! Unable to start Update32.exe! Return Code: "+str$(iReturn)
  707.                 endif
  708.             else
  709.                 WriteToLogFile "ERROR!! Unable to set the execution block! Internal System Error"
  710.  
  711.             endif
  712.         endif
  713.  
  714.     endif
  715.  
  716.  
  717.     if  g_iMethod <> c_iDISKIMAGE then
  718.         g_szDest = UIStartDlg( c_szMSCUISTF$, IDD_BILLBOARD_1,c_szBILLBOARD_DLG_PROC,0, c_szEMPTY)
  719.         iReturn = DoAladdin()
  720.         UIPop 1
  721.     endif
  722.  
  723.     if 0 = GetListLength(c_szFAILURE) then
  724.         if 0 <> GetListLength(c_szSUCCESS) then
  725.             iReturn = SetupUIDlg(c_szMSCUISTF$, IDD_VERIFICATION,c_szVERIFY_DLG_PROC , 0, c_szEMPTY )
  726.             UIPop 1
  727.         endif
  728.     else
  729.         iReturn = SetupUIDlg(c_szMSCUISTF$, IDD_VERIFICATION_W_FAIL, c_szVERIFY_FAIL_DLG_PROC, 0, c_szEMPTY)
  730.         UIPop 1
  731.     endif
  732.  
  733.  
  734.  
  735.     if  g_iMethod = c_iDISKIMAGE then
  736.         iReturn = SetupUIDlg(c_szMSCUISTF$, IDD_FINAL_IMAGES, c_szFINAL_DLG_PROC, 0, c_szEMPTY)
  737.     elseif g_iMethod = c_iNETADMIN then
  738.         iReturn = SetupUIDlg(c_szMSCUISTF$, IDD_FINAL_ADMIN, c_szFINAL_ADMIN_DLG_PROC, 0, c_szEMPTY)
  739.     elseif iPortType = c_iPT_NETWORK then
  740.         iReturn = SetupUIDlg(c_szMSCUISTF$, IDD_FINAL_NET, c_szFINAL_DLG_PROC, 0, c_szEMPTY )
  741.     else
  742.         iReturn = SetupUIDlg(c_szMSCUISTF$, IDD_FINAL, c_szFINAL_DLG_PROC, 0, c_szEMPTY )
  743.     endif
  744.  
  745.     UIPop 1
  746.  
  747.     if RestartListEmpty = 0  then
  748.  
  749.         WriteToLogFile "[RestartList]"
  750.  
  751.  
  752. RESTART:
  753.         if iPortType = c_iPT_NETWORK then
  754.             iReturn = SetupUIDlg(c_szMSCUISTF$, IDD_REBOOT_NET, c_szREBOOT_DLG_PROC, 0, c_szEMPTY)
  755.         else
  756.             iReturn = SetupUIDlg(c_szMSCUISTF$, IDD_ASK_REBOOT, c_szREBOOT_DLG_PROC, 0, c_szEMPTY)
  757.         endif
  758.  
  759.         if iReturn = c_iREBOOT then
  760.  
  761.             Clean
  762.             if ExitExecRestart = 0 then
  763.         '$IFDEF DEBUG
  764.         OutputDebugString("Error Restarting windows")
  765.         '$ENDIF
  766.  
  767.                 goto RESTART
  768.             endif
  769.         endif
  770.       elseif iReturn = c_iCONTINUE AND (g_pEnvironment[0].runTime.bReboot OR iRestartWin32 > 0) then
  771.         iReturn = SetupUIDlg(c_szMSCUISTF$, IDD_ASK_REBOOT, c_szREBOOT_DLG_PROC, 0, c_szEMPTY)
  772.         if iReturn = c_iREBOOT then
  773.  
  774.             if CleanTempDir(g_pEnvironment[0].szTempDir[0]) = 0 then
  775.             '$IFDEF DEBUG
  776.             OutputDebugString("error deleting temp dir: "+ g_pEnvironment[0].szTempDir[0] + chr$(10))
  777.             '$ENDIF
  778.             endif
  779.             Clean
  780.  
  781.            '$IFNDEF MSTEST_20
  782.            ''
  783.            '' If we are in NT then we need to do a different re-start method
  784.            ''
  785.            if g_pEnvironment[0].iOSIsNT = 1 then
  786.                g_szDest = MergeStrings(g_pEnvironment[0].szSystemDir[0],"32\hpreboot.exe")
  787.                iReturn = WinExec(g_szDest,SW_SHOWNORMAL  )
  788.                if iReturn < 32 then
  789.                    WriteToLogFile "ERROR!! Unable to start hpreboot.exe!.exe! Return Code: "+str$(iReturn)
  790.                endif
  791.            else
  792.                iReturn = ExitWindows(EW_RESTARTWINDOWS, 0)
  793.            endif
  794.            '$ENDIF
  795.         ''
  796.         '' If user answered NO to the re-start question and the hpreboot.exe file is still there
  797.         ''
  798.         else
  799.             g_szDest = MergeStrings(g_pEnvironment[0].szSystemDir[0],"32\hpreboot.exe")
  800.             RemoveFile g_szDest, cmoForce
  801.  
  802.         endif '' cjg 1-19
  803.     endif
  804.  
  805.  
  806.     GOTO QUIT
  807.  
  808.  
  809. QUIT:
  810.     Clean
  811.     ''UIPop 1
  812.  
  813.     END
  814.  
  815. ASKQUIT:
  816.     iReturn = SetupUIDlg(c_szMSCUISTF$, IDD_EXIT_INCOMPLETE, c_szEXIT_DLG_PROC, 0, c_szEMPTY)
  817.     if iReturn = c_iExit then
  818.         UIPopAll
  819.         ERROR STFQUIT
  820.     else
  821.         UIPop 1
  822.     endif
  823.  
  824.     RETURN
  825.  
  826. static sub Clean
  827.  
  828. '$IFDEF DEBUG
  829.         OutputDebugString "Cleaning up, CloseLogFile" + chr$(10)
  830. '$ENDIF
  831.  
  832.     CloseLogFile
  833.  
  834.  
  835.     '' Check if this is the Windows95 OS, if so check for the
  836.     '' existence of the .GID file.
  837.     if g_iIsChicago = 1 then
  838.         '' make the path to the .GID file
  839.         g_szDest = MakePath(g_pEnvironment[0].szTempDir[0], c_sz95HELPFILE)
  840.         '' Check to see if the file exists
  841.         if DoesFileExist(g_szDest,femExists) then
  842.             RemoveFile g_szDest, cmoForce
  843.         endif
  844.     endif
  845.  
  846.  
  847. '$IFDEF DEBUG
  848.         OutputDebugString "Releasing info file..." +chr$(10)
  849. '$ENDIF
  850.  
  851.     iReturn = ReleaseInfoFile()
  852.  
  853.  
  854. '$IFDEF DEBUG
  855.         OutputDebugString "calling support cleanup..." + chr$(10)
  856. '$ENDIF
  857.  
  858.     g_iReturn% = Cleanup()
  859.  
  860.  
  861.  
  862. '$IFDEF DEBUG
  863.         OutputDebugString "End of Clean up..." +chr$(10)
  864. '$ENDIF
  865.  
  866. end sub
  867.  
  868. STATIC FUNCTION DoMyMsgBox(iCap%, iMsg%, wType%) as integer
  869.     szCap$ = GetInstString(iCap)
  870.     szMsg$ = GetInstString(iMsg)
  871.     DoMyMsgBox = DoMsgBox(szCap, szMsg, wType)
  872. END FUNCTION
  873.  
  874. STATIC Function GetInstString(iStringId%) as string
  875.  
  876.     SetSymbolValue c_lpszINSTALL_STRING_LIST , c_szEMPTY
  877.     iret% = GetInstallString(iStringId, c_lpszINSTALL_STRING_LIST)
  878.     szString$ = GetListItem( c_lpszINSTALL_STRING_LIST, 1 )
  879.     GetInstString = szString
  880. END FUNCTION
  881.  
  882. STATIC Function MergeStrings (szStr1$, szStr2$) as string
  883.     g_szDest = STRING$(len(szStr1) + len(szStr2) + 10, 0)
  884.     lTemp& = lstrcat(g_szDest,szStr1)
  885.     lTemp& = lstrcat(g_szDest,szStr2)
  886.     MergeStrings = g_szDest
  887. END FUNCTION
  888.  
  889. '**
  890. '** Purpose:
  891. '**     Builds the copy list and performs all installation operations.
  892. '** Arguments:
  893. '**     none.
  894. '** Returns:
  895. '**     0 on success, nonzero on error.
  896. '*************************************************************************
  897. FUNCTION Install() STATIC    AS INTEGER
  898.     dim iReturn as integer
  899.  
  900.     '' Save user's options to log file
  901.     iReturn = LogUserOptions()
  902.     ''handle iReturn <> 0
  903.  
  904.     iReturn = PutComponentsInCopyList( c_lpszSECTION_LIST, c_lpszCOMPONENT_LIST )
  905.  
  906.     '' if iReturn is true then the setup.hp file is corrupt.
  907.     if iReturn then
  908.         iReturn = DoMyMsgBox( IDS_CORRUPT_SETUP_FILE, IDS_ABORT_INSTALL, MB_OK or MB_APPLMODAL or MB_ICONSTOP )
  909.         iReturn = c_iINVALID
  910.  
  911.     else
  912.         '' Create copy list and copy files
  913.         iReturn = CopyFiles()
  914.         ''handle iReturn <> 0
  915.     endif
  916.     Install = iReturn
  917. END FUNCTION
  918.  
  919.  
  920. FUNCTION LogEnvironment() STATIC as integer
  921.  
  922. ''$IFDEF LOG_PROTO
  923.     dim szLogFile as STRING
  924. ''$ENDIF
  925.  
  926.     g_pEnvironment = GetInstallEnvironment()
  927.  
  928.     szTemp$ = g_pEnvironment[0].szWindowsDir[0]
  929.  
  930. ''$IFDEF LOG_PROTO
  931.     '' Get the System LogFile from the setup.hp file and put it in the LogFileSymbolTableList
  932.     iRet% = GetSystemLogFile()
  933.  
  934.  
  935.     if iRet = 0 then
  936.         iRet = 1
  937.         if GetListLength(c_szLOG_FILE_LIST) = 1 then
  938.             szLogFile = GetListItem( c_szLOG_FILE_LIST, 1 )
  939.             if lstrlen(szLogFile) > 0 then
  940.                 szLogFile = MakePath(szTemp$, szLogFile)
  941.                 iRet = 0
  942.             endif
  943.         endif
  944.      endif
  945.  
  946.      if iRet = 1 then
  947.         szLogFile = MakePath(szTemp$, c_szLOG_FILE)
  948.      endif
  949.      OpenLogFile szLogFile, 0
  950. ''$ENDIF
  951.  
  952. ''    OpenLogFile MakePath(szTemp$, c_szLOG_FILE), 0
  953.  
  954.     WriteToLogFile "[System Environment]"
  955.     lFree& =  GetFreeSpaceForDrive("C")
  956.     if lFree > 1024 then
  957.         lFree = lFree /1024
  958.     endif
  959.     lTotal& = GetTotalSpaceForDrive("C")
  960.     if lTotal > 1024 then
  961.         lTotal = lTotal / 1024
  962.     endif
  963.     WriteToLogFile "Disk Space: " + str$(lFree) + "K bytes free out of " + str$(lTotal) + "K bytes total space"
  964.     lFreeMem = GetFreeSpace(0)
  965.     if lFreeMem > 1024  then
  966.         lFreeMem = lFreeMem / 1024
  967.     endif
  968.     WriteToLogFile "Memory: " + str$(lFreeMem) + "K bytes free"
  969.     WriteToLogFile "Windows Version: " + str$(g_pEnvironment[0].iOSMajor) + " ." + str$(g_pEnvironment[0].iOSMinor)
  970.     WriteToLogFile "Path: " + GetEnvVariableValue("PATH")
  971.  
  972.     WriteToLogFile MergeStrings("Windows Directory: ", g_pEnvironment[0].szWindowsDir[0])
  973.     WriteToLogFile MergeStrings("System Directory: ", g_pEnvironment[0].szSystemDir[0])
  974.     WriteToLogFile ""
  975.     WriteToLogFile ""
  976.  
  977.     LogEnvironment = 0
  978. END FUNCTION
  979.  
  980. FUNCTION LogInstallation(szSection$) STATIC as integer
  981.     iLen% = GetListLength(c_szLOG_FILE_LIST)
  982.     if 0 <> iLen then
  983.         WriteToLogFile ""
  984.         WriteToLogFile szSection
  985.           iStart% = 1
  986.         while iLen >= iStart
  987.             WriteToLogFile GetListItem(c_szLOG_FILE_LIST, iStart)
  988.             iStart = iStart + 1
  989.         wend
  990.     endif
  991.     iLen = FSetSymbolValue( c_szLOG_FILE_LIST, c_szEMPTY)
  992.     LogInstallation = 0
  993. END FUNCTION
  994.  
  995.  
  996. FUNCTION LogUserOptions() STATIC as integer
  997.  
  998.     DIM szTemp$
  999.     WriteToLogFile "[User Selected Options]"
  1000.     g_pEnvironment = GetInstallEnvironment()
  1001.     SELECT CASE g_pEnvironment[0].runTime.iInstallMethod
  1002.  
  1003.         CASE IM_MINIMUM
  1004.             szTemp = "Minimum"
  1005.         CASE IM_COMPLETE
  1006.             szTemp = "Complete"
  1007.         CASE IM_CUSTOM
  1008.             szTemp = "Custom"
  1009.         CASE IM_NETADMIN
  1010.             szTemp = "Net Admin"
  1011.  
  1012.     END SELECT
  1013.     WriteToLogFile "Method of Installation : " + szTemp
  1014.  
  1015.     WriteToLogFile MergeStrings("Select Port: ", g_pEnvironment[0].runtime.lpszPort[0])
  1016.  
  1017.     WriteToLogFile MergeStrings("Select Printer: ",g_pEnvironment[0].runtime.lpszDeviceID[0] )
  1018.     WriteToLogFile ""
  1019.     WriteToLogFile ""
  1020.  
  1021.     LogUserOptions = 0
  1022. END FUNCTION
  1023.  
  1024. FUNCTION CopyFiles() STATIC as integer
  1025.     dim szSection as string
  1026.     dim szDest as string
  1027.     iReturn% = 0
  1028.  
  1029.     ClearCopyList
  1030.     ClearBillboardList
  1031.     iGaugeX% = GetGaugeDlgUnitsX()
  1032.     iGaugeY% = GetGaugeDlgUnitsY()
  1033.  
  1034.         iX% = ((g_pEnvironment[0].iDisplayX  )/2 / iGaugeX) * 4
  1035.         iX = iX -  (c_iPROGRESS_WIDTH)/8
  1036.         iY = 2
  1037.         SetCopyGaugePosition iX,iY
  1038.  
  1039.     AddToBillBoardList  c_szMSCUISTF, IDD_BILLBOARD_1,c_szBILLBOARD_DLG_PROC,1
  1040.     AddToBillBoardList  c_szMSCUISTF, IDD_BILLBOARD_2,c_szBILLBOARD_DLG_PROC,1
  1041.     AddToBillBoardList  c_szMSCUISTF, IDD_BILLBOARD_3,c_szBILLBOARD_DLG_PROC,1
  1042.     AddToBillBoardList  c_szMSCUISTF, IDD_BILLBOARD_4,c_szBILLBOARD_DLG_PROC,1
  1043.     AddToBillBoardList  c_szMSCUISTF, IDD_BILLBOARD_5,c_szBILLBOARD_DLG_PROC,1
  1044.  
  1045.     SrcDir$ = GetSymbolValue("STF_SRCDIR")
  1046.     TempDir$ = g_pEnvironment[0].szTempDir[0]
  1047.  
  1048.     ReadInfFile MakePath(TempDir$, c_szINFO_FILE)
  1049.  
  1050.     iListLen% = GetListLength( c_lpszSECTION_LIST )
  1051.  
  1052.     while iListLen > 0
  1053.  
  1054.         szDest = GetListItem( c_lpszSECTION_LIST, iListLen )
  1055.         iListLen = iListLen - 1
  1056.         szSection = GetListItem( c_lpszSECTION_LIST, iListLen )
  1057.         iListLen = iListLen - 1
  1058.         '' If this is true then setup file is corrupted
  1059.         if lstrlen(szSection) = 0 OR lstrlen(szDest) = 0 then
  1060. '$IFDEF DEBUG
  1061.             OutputDebugString( "Error Adding section: " + szSection + ", to dest: " + szDest + chr$(10) )
  1062. '$ENDIF
  1063.             iReturn = c_iINVALID
  1064.             goto ABORT
  1065.         endif
  1066. '$IFDEF DEBUG
  1067.         OutputDebugString( "Adding section: " + szSection + ", to dest: " + szDest + chr$(10) )
  1068. '$ENDIF
  1069.         AddSectionFilesToCopyList szSection, srcDir,  szDest  '' MergeStrings(g_pEnvironment[0].szWindowsDir[0],c_szEMPTY)
  1070.     wend
  1071.     ''DumpCopyList "c:\copylist.txt"
  1072.     CopyFilesInCopyList
  1073.  
  1074.     ClearCopyList
  1075.     ClearBillboardList
  1076.  
  1077. ABORT:
  1078.     RemoveSymbol c_lpszSECTION_LIST
  1079.     RemoveSymbol c_lpszCOMPONENT_LIST
  1080.       CopyFiles = iReturn
  1081. END FUNCTION
  1082.  
  1083.  
  1084. static FUNCTION DoAladdin() as integer
  1085.     if IsComponentSelected(c_szALADDIN) then
  1086.  
  1087.  
  1088.         if IsComponentSelected( c_szALADDIN_CUSTOM) then
  1089.             g_szDest = UIStartDlg( c_szMSCUISTF, IDD_ALADDIN, c_szALADDIN_DLG_PROC, 0, c_szEMPTY)
  1090.             UIPop 1
  1091.         else
  1092.  
  1093.             szDir$ = STRING$(MAX_PATH, 0)
  1094.             if GetComponentDir(c_szALADDIN, szDir) = 0  then
  1095.                 '' handle this later
  1096.             endif
  1097.  
  1098.             szAladdin$ = c_szEMPTY
  1099.  
  1100.             if lstrlen(szDir) <> 0 then
  1101.                 szAladdin = MakePath(szDir ,c_szALADDIN_CMD_LINE)
  1102.             else
  1103.                 szAladdin = c_szALADDIN_CMD_LINE
  1104.             endif
  1105.  
  1106.             if IsComponentSelected( c_szALL_FONTS ) then
  1107.                 szAladdin = szAladdin + MakePath(g_pEnvironment[0].szTempDir[0], c_szALLFONTS_FILE)
  1108.             elseif IsCurrentPrinterPostScript() = 1 then
  1109.                 szAladdin = szAladdin + MakePath(g_pEnvironment[0].szTempDir[0], c_szFONTLIST_PS)
  1110.             else
  1111.                 szAladdin = szAladdin + MakePath(g_pEnvironment[0].szTempDir[0], c_szFONTLIST_PCL)
  1112.             endif
  1113. '$IFDEF DEBUG
  1114.         OutputDebugString " Aladdin CommandLine: " +szAladdin+chr$(10)
  1115. '$ENDIF
  1116.             if SetExecBlock(szAladdin, c_szALADDIN_EXIT_MSG) then
  1117.                 g_szDest = UIStartDlg( c_szMSCUISTF, IDD_INVISIBLE, c_szEXECUTE_DLG_PROC, 0, c_szEMPTY)
  1118.                 UIPop 1
  1119.                 iReturn = GetExecBlockReturn()
  1120.  
  1121.                 if iReturn < 32 then
  1122.                     g_szDest = GetInstString(IDS_UNABLE_ALADDIN_1) +" "+ GetInstString(IDS_UNABLE_ALADDIN_2) + GetInstString(IDS_UNABLE_ALADDIN_3)
  1123.                     iRet% = DoMsgBox(g_szDest,GetInstString(IDS_UNABLE_ALADDIN_CAP) , MB_TASKMODAL+ 64 +MB_OK)
  1124.                     UIPop 1
  1125.                 else
  1126.                     '' Since it worked, set iReturn to 0 so that we return success bdg 10/14/94
  1127.                     iReturn = 0
  1128.                 endif
  1129.  
  1130.             else
  1131.                '' There was a problem so tell the user how to run aladdin from the icon.
  1132.                g_szDest = UIStartDlg( c_szMSCUISTF, IDD_ALADDIN, c_szALADDIN_DLG_PROC, 0, c_szEMPTY)
  1133.                UIPop 1
  1134.             endif
  1135.         endif
  1136.     endif
  1137. END FUNCTION
  1138.  
  1139. '**
  1140. '** Purpose:
  1141. '**     Appends a file name to the end of a directory path,
  1142. '**     inserting a backslash character as needed.
  1143. '** Arguments:
  1144. '**     szDir$  - full directory path (with optional ending "\")
  1145. '**     szFile$ - filename to append to directory
  1146. '** Returns:
  1147. '**     Resulting fully qualified path name.
  1148. '*************************************************************************
  1149. FUNCTION MakePath( szDir$, szFile$ ) STATIC AS STRING
  1150.     IF szDir$ = c_szEMPTY THEN
  1151.         MakePath = szFile$
  1152.     ELSE
  1153.         IF szFile$ <> c_szEMPTY THEN
  1154.             IF MID$(szDir$, lstrlen(szDir$), 1) <> "\" THEN
  1155.                 szDir = MergeStrings(szDir, "\")
  1156.             ENDIF
  1157.             szDir = MergeStrings(szDir, szFile)
  1158.         ENDIF
  1159.         MakePath = szDir$
  1160.     END IF
  1161. END FUNCTION
  1162.  
  1163. STATIC FUNCTION SetupUIDlg(szDll$, idDlg%, szDlgProc$, idHelpDlg%, szHelpProc$) as integer
  1164.  
  1165.  
  1166.     sz$ = UIStartDlg( szDll, idDlg, szDlgProc, idHelpDlg, szHelpProc)
  1167.     iReturn% = GetButtonId(sz)
  1168.     SetupUIDlg = iReturn
  1169.  
  1170. END FUNCTION
  1171.  
  1172. STATIC FUNCTION GetButtonId(szString$) as integer
  1173.  
  1174.     SELECT CASE szString
  1175.         CASE IDC_COMPLETE_SYMBOL
  1176.             GetButtonId =  c_iCOMPLETE
  1177.         CASE IDC_CUSTOM_SYMBOL
  1178.             GetButtonId =  c_iCUSTOM
  1179.         CASE IDC_MINIMUM_SYMBOL
  1180.             GetButtonId =  c_iMINIMUM
  1181.         CASE IDC_DISKIMAGE_SYMBOL
  1182.             GetButtonId =  c_iDISKIMAGE
  1183.         CASE IDC_NETADMIN_SYMBOL
  1184.             GetButtonId =  c_iNETADMIN
  1185.         CASE IDC_RETRY_SYMBOL
  1186.             GetButtonId =  c_iRETRY
  1187.         CASE IDC_SKIP_SYMBOL
  1188.             GetButtonId =  c_iSKIP
  1189.         CASE IDC_PORT_SYMBOL
  1190.             GetButtonId =  c_iPORT
  1191.         CASE IDC_SELECT_COMPONENTS_SYMBOL
  1192.             GetButtonId =  c_iSELECT_COMPONENTS
  1193.         CASE IDC_SELECT_PORT_SYMBOL
  1194.             GetButtonId =  c_iSELECT_PORT
  1195.         CASE IDC_SELECT_PRINTER_SYMBOL
  1196.             GetButtonId =  c_iSELECT_PRINTER
  1197.         CASE IDC_REBOOT_SYMBOL
  1198.             GetButtonId =  c_iREBOOT
  1199.         CASE IDC_RESUME_SYMBOL
  1200.             GetButtonId =  c_iRESUME
  1201.         CASE IDC_BACK_SYMBOL
  1202.             GetButtonId =  c_iBACK
  1203.         CASE IDC_CONTINUE_SYMBOL
  1204.             GetButtonId =  c_iCONTINUE
  1205.         CASE IDC_EXIT_SYMBOL
  1206.             GetButtonId =  c_iEXIT
  1207.         CASE IDOK_SYMBOL
  1208.             GetButtonId =  c_iOK
  1209.         CASE IDCANCEL_SYMBOL
  1210.             GetButtonId =  c_iCANCEL
  1211.         CASE IDYES_SYMBOL
  1212.             GetButtonId =  c_iYES
  1213.         CASE IDNO_SYMBOL
  1214.             GetButtonId =  c_iNO
  1215.         CASE ELSE
  1216.             GetButtonId = c_iINVALID
  1217.  
  1218.     END SELECT
  1219. END FUNCTION
  1220.  
  1221.